// pages/tuijianResult_lfy/tuijianResult_lfy.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
      person:[]
    
  },

  /**
   * 生命周期函数--监听页面加载
   */
  zixunshi(e) {
   console.log(e);
    const clickedPerson = e.currentTarget.dataset.person.zixunshiId;
    console.log(clickedPerson);
    wx.request({
      url: 'http://localhost:8080/zixunshi/city',
      method:'POST',
      data:clickedPerson,
      success:function(res){
         wx.navigateTo({
            url: '/pages/zixunshi_lfy/zixunshi_lfy?clickedPerson='+clickedPerson,
            success: function (res) {
            console.log("跳转成功");
            },
            fail: function (res) {
            console.log("跳转失败");
            },
            complete: function (res) {
            console.log("跳转完成....");
            }
        });
    },
    fail:function(res){
        console.log("请求失败");
    }
    })
  },
  onLoad(options) {
      console.log(options);
      if(options.sign==='1'){
          const gradeName=options.gradeName;
        const yuyueTime=options.yuyueTime;
        const yuyueUid=options.yuyueUid;
        const yuyueType=options.yuyueType;
        const yuyueContent=options.yuyueContent;
        let url1='?yuyueTime=' + yuyueTime + '&yuyueUid=' + yuyueUid + '&yuyueType=' + yuyueType + '&yuyueContent=' + yuyueContent ;
        wx.request({
          url: 'http://localhost:8080/yuyue/insert'+url,
          method:'POST',
          success:(res)=>{
              console.log("预约成功");
          }
        }),

        wx.request({
          url: 'http://localhost:8080/zixunshi/all?gradeName'+gradeName,
          method:'GET',
          success:(res)=>{
              this.setData({
                  person:res.data.data
              })
          }
        })

      }else{
        const address=options.address;
        const gradeName=options.gradeName;
        const adeptName=options.adeptName;
        const sex=options.sex;
        const type=options.type;
        let url='?address=' + address + '&gradeName=' + gradeName + '&adeptName=' + adeptName + '&sex=' + sex + '&type=' + type;
        wx.request({
        url: 'http://localhost:8080/zixunshi/all1'+url,
        method:'POST',
        success:(res)=>{
            console.log(res);
            this.setData({
                person:res.data.data
            })
        }
        })
    }
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})